/**
 * ReportGear(2011)
 */
package com.reportgear.report.model.auxiliary;

/**
 * 列属性
 * 
 * @version 1.0 2011-3-12
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since Report 1.0
 * 
 */
public final class ColumnProperty extends AbstractCRProperty<ColumnType> implements Cloneable {
	/**
	 * 构造函数
	 * 
	 * @param width
	 *            值
	 */
	public ColumnProperty(int width) {
		this(ColumnType.NORMAL, width);
	}

	/**
	 * 构造函数
	 * 
	 * @param type
	 *            类型
	 * @param width
	 *            值
	 */
	public ColumnProperty(ColumnType type, int width) {
		this.type = type;
		this.setValue(width);
	}

	@Override
	public String toString() {
		return "类型=" + type + ",宽度=" + this.getValue() + ",可见性=" + this.isVisible();
	}

	@Override
	public ColumnProperty clone() {
		try {
			return (ColumnProperty) super.clone();
		} catch (CloneNotSupportedException e) {
			throw new InternalError();
		}
	}

	@Override
	public void setType(String typeName) {
		this.setType(Enum.valueOf(ColumnType.class, typeName));
	}
}
